package org.springframework.boot.netty.argumentResolver;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.SmartInitializingSingleton;
import org.springframework.boot.autoconfigure.netty.NettyProperties;
import org.springframework.boot.netty.listener.Message;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * Author: huoxingzhi
 * Date: 2021/1/14
 * Email: hxz_798561819@163.com
 */
public class ThrowableResolverAdapter implements ThrowableResolver, ApplicationContextAware, SmartInitializingSingleton {

    protected ApplicationContext applicationContext;

    protected NettyProperties properties;

    @Override
    public boolean supportsThrowable(Exception e) {
        return false;
    }

    @Override
    public void resolveException(Message message, Exception e) {

    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

        this.applicationContext = applicationContext;
    }

    @Override
    public void afterSingletonsInstantiated() {

        this.properties = this.applicationContext.getBean(NettyProperties.class);
    }
}
